/*
 *	ME2 C++ SDK
 *	Copyright (c) 2010 _silencer
 *
 *	Permission is hereby granted, free of charge, to any person
 *	obtaining a copy of this software and associated documentation
 *	files (the "Software"), to deal in the Software without
 *	restriction, including without limitation the rights to use,
 *	copy, modify, merge, publish, distribute, sublicense, and/or sell
 *	copies of the Software, and to permit persons to whom the
 *	Software is furnished to do so, subject to the following
 *	conditions:
 *
 *	The above copyright notice and this permission notice shall be
 *	included in all copies or substantial portions of the Software.
 *
 *	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *	EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *	OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *	HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *	WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *	OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef UNREAL_STRUCT_H
#define UNREAL_STRUCT_H

#include "unreal_field.h"
#include "unreal_base.h"
#include "unreal_property.h"

namespace unreal
{
	#pragma pack(push)
	#pragma pack(1)

	/*
		TODO more reverse engineering!
	 */
	class ustruct: public ufield
	{
		DECLARE_CORE_CLASS( ustruct, ufield, Struct )

	public:

		utextbuffer* get_script_text()
		{
			return script_text_;
		}

		utextbuffer* get_cpp_text()
		{
			return cpp_text_;
		}

		ufield* get_children()
		{
			return children_;
		}

		uint32 get_properties_size() const
		{
			return properties_size_;
		}

		uint32 get_properties_align() const
		{
			return properties_align_;
		}

		uarray<uint8>& get_script()
		{
			return script_;
		}

		void set_script_text( utextbuffer* script_text )
		{
			script_text_ = script_text;
		}

		void set_cpp_text( utextbuffer* cpp_text )
		{
			cpp_text_ = cpp_text;
		}

		void set_children( ufield* children )
		{
			children_ = children;
		}

		void set_properties_size( const uint32 properties_size )
		{
			properties_size_ = properties_size;
		}

		void set_properties_align( const uint32 properties_align )
		{
			properties_align_ = properties_align;
		}

	private:

		utextbuffer* script_text_;//maybe correct
		utextbuffer* cpp_text_;//maybe correct
		ufield* children_;//correct
		uint32 properties_size_;//correct
		uarray<uint8> script_;//correct
		uint32 text_pos_;//???
		uint32 friendly_name_;//???
		uint32 properties_align_;//correct
		uproperty* ref_link_;//it's a property
		uproperty* struct_link_;//it's a property
		uproperty* property_link_;//it's a property
		uproperty* config_link_;//???
		uproperty* constructor_link_;//???
		uproperty* some_property_;//???
		uarray<uint8> some_array_;//???
	};

	#pragma pack(pop)
}

#endif
